<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>

    <link type="text/css" rel="stylesheet" href="../Public/css/reset.css">
    <link type="text/css" rel="stylesheet" href="../Public/css/DateTimePicker.css">
    <link type="text/css" rel="stylesheet" href="../Public/css/style.css">
    <link type="text/css" rel="stylesheet" href="../Public/script/uploadify.css">
    <link type="text/css" rel="stylesheet" href="../Public/font-awesome/css/font-awesome.css">
    <script type="text/javascript" src="../Public/script/jquery.js"></script>
    <script type="text/javascript" src="../Public/layer/layer.js"></script>

    <style>

        .uploadify-button {
            background: url(../Public/images/个人中心-设计师申请_+.png) no-repeat;
            padding-top: 80px;
            border: 1px solid #fff;
            display: block;
            border-radius: 0px;

        }

        .uploadify:hover .uploadify-button {
            background: url(../Public/images/个人中心-设计师申请_+.png) no-repeat;
            padding-top: 70px;

        }

        .uploadify-queue {
            display: none;
        }

        .groupCont {
            background: #EEEEEE;
            min-height: 700px;
        }

        .groupList {
            margin-top: 60px;
        }

        .bi {
            margin-bottom: 60px;
            margin-top: 60px;
        }
        .l-hotel{display: flex}
        .hotel-time{flex: 1}
        .hotel-repaly{flex: 1;    text-align: right;}
        .input-group{
            margin-left: 20px;
            margin-bottom: 10px;
        }
        .input-group2{
            margin-left: 2px;
            margin-bottom: 10px;
        }
        .other{margin-bottom: 60px;}
        .input-group .comments{    width: 700px;  height: 70px;}
        .cx{padding: 10px 0!important;    margin-left: 40px;}
        .submit-btn{border-radius: 6px;}
    </style>
</head>

<body>
<include file="Common:header"/>
<!--contain-->
<div class="contain">

    <div class="groupCont">
        <div class="gcBlank"></div>
        <div class="widthBlock">
            <div class="groupList comment-area" id="comments">
                <div class="li">
                    <div class="user fl"><img style="width:80px; height:58px;" src="Uploads/{$list.touxiang}">
                        <p>{$list.xingming}</p></div>
                    <div class="other fr">
                        <div class="p1"><h1>{$list.title}</h1>
                            <p>{$list.content}</p>
                            <div class="imgs">
                                <foreach name="ace" item="vo">
                                    <img src="Uploads/{$vo}">
                                </foreach>
                            </div>
                            <div class="btn">
                                <span class="fl">{:date('Y-m-d H:i:s',$list['time'])}</span>
                             <!--    <a href="javascript:;" onclick="zan()">
                                    <img src="App/Home/View/Public/images/group_icon02.png">
                                </a> -->
                            </div>
                        </div>
                        <!--评论内容-->
                        <div class="p2">
                            <foreach name="commentList" item="vo">
                               <ul style="padding-left:{$vo['level']-1}cm">
                                    <li>
                                    <empty name="vo.touxiang">
                                     <div class="img fl">
                                        <img width="80" height="48" src="App/Home/View/Public/images/abccc.png">
                                    </div>
                                    </empty>
                                     <notempty name="vo.touxiang">
                                    <div class="img fl">
                                        <img width="80" height="48" src="Uploads/{$vo.touxiang}">
                                    </div>
                                        </notempty>
                                    <div class="text fr comment-body" style="width: 100%; ">
                                        <h1 >{$vo.full_name}</h1>
                                         <p >{$vo.content|reFace}</p>
                                        <div class="l-hotel">
                                            <div class="hotel-time"><h2>{$vo.createtime}</h2></div>
                                            <div class="hotel-repaly"><a class="hf" id="{$vo.id}" data-id="{$vo.uid}">回复<i class="fa fa-comment"></i></a></div>
                                        </div>
                                    </div>
                                    <div class="clear"></div>
                                   </li>
                               </ul>

                            </foreach>

                        </div>
                        <div class="submit bi">
                            <div class="input-group">
                                <span class="emotion input-group">
                                    <i class="fa fa-weixin fa-lg"></i>表情
                                </span>
                            </div>
                            <input name="content" id="content-text" class="comments"
                                   style="vertical-align: middle; width: 810px;height: 60px;padding: 0 15px;border: 1px solid #dcdcdc; font-size: 16px; margin-left:30px; box-sizing: border-box;"
                                   type="text" placeholder="发表评论">

                            <input type="hidden" name="qz_id" value="{$list.id}"/>
                            <input type="hidden" name="to_uid" value="{$list.uid}"/>
                            <input type="hidden" name="parentid" value="0"/>

                            <a class="ci" type="submit" style=" vertical-align: middle;width: 130px;
                            height: 60px;
                            border: none;
                            padding: 0;
                            background-color: #49bf9d;
                            font-size: 16px;
                            color: #fff;
                            display:block;
                            float:right;
                            text-align: center;
                            line-height: 60px;
                            margin-right:30px;
                            cursor: pointer;" onclick="comment_submit()">发送</a></div>
                            <div class="cornor"><img src="App/Home/View/Public/images/cornor.png"></div>
                    </div>
                    <div class="clear"></div>
                </div>

            </div>
        </div>
    </div>

</div>
<include file="Common:footer"/>
<script type="text/javascript">document.getElementById("menu4").className = "curr";</script>
<script type="text/javascript" src="../Public/script/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../Public/script/jquery.qqFace.js" ></script>
<script type="text/javascript">
    $(function() {
        $('.emotion').qqFace({
            id: 'facebox', //表情ID
            assign: 'content-text', //赋予到具体位置
            path: '../Public/Face/'    //表情路径
        });
        $(".hf").click(
            function(e) {
                var name="{$Think.session.userr}";                      //发表评论的用户名
                var uid="{$Think.session.userid}";
                if(name==""|| uid==""){
                    layer.alert("请先登录,然后进行回复");
                    return;
                }else{
                var $this = $(this);
                if ($this.parent().parent().next().hasClass('hftext')) {
                    $this.parent().parent().next().remove();
                } else {
                    $this.parent().parent().after('<div class="hftext"><form action="" method="post" role="form"> <input id="parentid" type="hidden" name="parentid" value="{$vo.id}"/> <input type="hidden" name="name" value="{$Think.session.userr}"><input type="hidden" name="uid"  value="{$Think.session.userid}"> <input type="hidden" name="qz_id" value="{$list.id}"> <input type="hidden"  id="to_uid" name="to_uid" value="{$vo.uid}"> <div class="input-group home-from-box"></div> <div class="input-group"> <span class="input-group emotion2"><span class="emotion input-group2"><i class="fa fa-weixin fa-lg"></i>表情</span></span></div> <div class="input-group"> <textarea style="display: inline" class="input-group comments" id="content-text2" name="content" rows="3" placeholder="请输入评论内容"></textarea></div> <div class="submit cx"> <input style="width:100px;height:35px; padding: 0 30px; " class="submit-btn"  onclick="comment_submit()" value="提交"> </div> </form> </div>');
                    var v_id = $(e.target).attr('id');      //获取元素id;
                    var uid = $(e.target).attr('data-id'); // 被回复者的id
                    $("#parentid").val(v_id);
                    $("#to_uid").val(uid);
                    //console.log(uid);
                    $('.emotion2').qqFace({
                        id: 'facebox', //表情ID
                        assign: 'content-text2', //赋予到具体位置
                        path: '../Public/Face/'   //表情路径
                    });
                }
                }
//                $(".submit-btn").click(function() {
//                    var $this = $(this);
//                    var name = $this.parent().siblings().children('.name1').val();
//                    var content = $this.parent().siblings().children('.comment').val();
//                    if (name == "" || content == "") {
//                        alert("昵称或者评论不能为空哦");
//                        return false;
//                    }
//                });
            });


    });

    function comment_submit() {
        var name="{$Think.session.userr}";                      //发表评论的用户名
        var uid="{$Think.session.userid}";                    //发表评论的用户id
        var qz_id=$("input[name='qz_id']").val();                // 圈子id
        var parentid=$("input[name='parentid']").val() ;        // 被回复的评论id
        var to_uid=$("input[name='to_uid']").val();            // 被评论的用户id
//        var content=$("input[name='content']").val();                     // 内容
        var content=$(".comments").val();
        if(name==""|| uid==""){
            layer.alert("请先登录,然后发表评论");
            return;
        }

        if (content=="" || content == undefined) {
            layer.alert("请输入评论内容");
            return;
        }
        $.post("{:U('Quanzi/comment_post')}",{
            full_name:name,
            uid:uid,
            qz_id:qz_id,
            parentid:parentid,
            to_uid:to_uid,
            content:content,
        },function (data) {
           if(data.status == 1){
               window.location.reload();//刷新当前页面.
           }else {
               layer.alert('发布失败');
           }
       },'json');

    }


</script>
</body>
</html>